package com.demo.spring.aware;

import org.springframework.context.EmbeddedValueResolverAware;
import org.springframework.stereotype.Component;
import org.springframework.util.StringValueResolver;

/**EmbeddedValueResolverAware：解析表达式#{} ${}
BeanNameAware：当前bean的名字
ApplicationContextAware ：获得当前上下文
 * @author zhangsulei
 *
 */
@Component
public class MyEmbeddedValueResolver implements EmbeddedValueResolverAware {

    @Override
    public void setEmbeddedValueResolver(StringValueResolver resolver) {
    	System.out.println("set embeddedValueResolver: " + resolver);
        String str = "Hello, word ${os.name}, age is #{10*3}";
        String s = resolver.resolveStringValue(str);
        System.out.println(s);
    }

}